<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@ taglib uri="http://www.yaodian100.com/jsp/yaodian100" prefix="yaodian100" %>
${pu:reqSet('user', pu:user())}
<%@	page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<script type="text/javascript" charset="UTF-8" src="/js/jquery-ui-1.7.2.custom.min.js"></script>
<!-- 验证 -->
		<script type="text/javascript" charset="UTF-8" src="/js/formValidator_min.js"></script>
		<script type="text/javascript" charset="UTF-8" src="/js/formValidator.js"></script>
		<script type="text/javascript" charset="UTF-8" src="/js/formValidatorRegex.js"></script>
		<link rel="stylesheet" type="text/css" href="/css/validator.css"/>
		<!-- 数字验证 -->
		<script type="text/javascript" charset="UTF-8" src="/js/jquery.alphanumeric.js"></script>
		<!-- 地址选单 -->
		<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipcode.js"></script>
		<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.ext.js"></script>
		<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.js"></script>
		<script type="text/javascript" charset="UTF-8" src="/js/jquery.templating.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.tools.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/tabs.css"/>
<script type="text/javascript">
	$().ready(function() {
		$("ul.tabs").tabs("div.panes > div"); 
		//快速解锁
		$("#unLock").click(function(){
			$.getJSON("${midContextPath}/member/blackList!unBlock.do?type=json", 
					{blackListId:"${member.blackListId}"}
				,function(member){
					if ( member.status == "00" )
						alert("解锁成功");
					else
						alert("解锁失败");
					location.href="${midContextPath}/member/view.do?memberId=" + member.memberId;
				}
			);
		});
		doAR('${midContextPath}/member/addressBook!search.do?AJAX=true&refreshZone=tabs-1&memberId=${member.memberId}','tabs-1');
		
		//忘记密码
		$("#ftPwd").click(function(){
			$.getJSON("${midContextPath}/member/forgetpwd.do?type=json", 
					{memberId:"${memberId}"}
				,function(ftPwdResult){
					alert(ftPwdResult);
				});
		});

		//修改email
		$("#updEmailLink").click(function(){
			openDialog("修改email",$("#updEmailDialog").load("${midContextPath}/member/loadUpdEmail.do?memberId=${member.memberId}"));
			
		});
	});

	function clearRegMobileInfo(type){
		$.post("${midContextPath}/member/jsonClearRegMobileInfo.do",{memberId:'${memberId}',status:type},
				function callback(result){
					alert(result);
				},
				"json");
	}
</script>

<h1>会员管理</h1>
<div class="f-link">
<c-rt:if test="${not empty pop}"><a href="javascript:window.close()">关闭视窗</a> / </c-rt:if>
<c-rt:if test="${'nonmember' eq member.applySource or not empty member.activeDate }">
	<yaodian100:checkPermission permissions="ROLE_CRM_MANAGER">
	<a href="${midContextPath}/applyCashOut/getMemberData.do?memberId=${member.memberId}">申请提现</a> /
	</yaodian100:checkPermission> 
</c-rt:if>
<a href="../cs/page.do?questionType=CommonQuestion&iamlazy=question&formType=workOrder&isProductQAA=false&memberId=${member.memberId}&channel=${pu:substring(user.group.code, 0, 1)=='C' ? 'CS':'SYS'}" target="_wo">开立工单</a> / <a href="../workOrder/page.do?iamlazy=list&memberId=${member.memberId}&fromOrder=true" target="_wol">问答纪录</a>/ <c-rt:if test="${pu:substring(user.group.code, 0, 1)!='C'}"><a href="${midContextPath}/member/search.do">回会员查询页</a></c-rt:if><c-rt:if test="${pu:substring(user.group.code, 0, 1)=='C'}"><a href="../crmQuery/search.do">回CRM 查询</a></c-rt:if>
</div><BR></BR><font color="red"><b>红字表示尚未激活</b></font>
<table class="tb-data" width="100%">
	<tr>
		<th>会员编号</th>
		<td>${member.memberId}</td>
		<th>登入代码</th>
		<td>
		<c-rt:choose>
			<c-rt:when test="${empty member.activeDate}">
				<font color="red"><b>${member.loginId}</b></font>
			</c-rt:when>
			<c-rt:otherwise>
				${member.loginId}
			</c-rt:otherwise>
		</c-rt:choose>
		</td>
		<th>电子邮件</th>
		<td>${pu:maskEmail(member.email)}<c-rt:if test="${member.edm eq 'Y'}">(已订阅)</c-rt:if><c-rt:if test="${member.edm eq 'N'}">(未订阅)</c-rt:if> </td>
	</tr>
	<tr>
		<th>积分</th>
		<td><fmt-rt:formatNumber value="${member.balance.bonusBalance}" pattern="#0.00"/></td>
		<th>礼品卡</th>
		<td><fmt-rt:formatNumber value="${member.balance.giftcardBalance}" pattern="#0.00"/></td>
		<th>积点[暂不支援]</th>
		<td><fmt-rt:formatNumber value="${member.balance.pointBalance}" pattern="#0.00"/></td>
	</tr>
	<tr>
		<th>帐户</th>
		<td><fmt-rt:formatNumber value="${member.balance.virtualBalance}" pattern="#0.00"/></td>
		<th>需支付订单</th>
		<td><fmt-rt:formatNumber value="${member.balance.orderToPay}" pattern="#0"/></td>
		<th>已回[二周内]/发问商品提问</th>
		<td><fmt-rt:formatNumber value="${member.balance.repliedProductQuestion}" pattern="#0"/>/<fmt-rt:formatNumber value="${member.balance.askedProductQuestion}" pattern="#0"/></td>
	</tr>	
	<tr>
		<th>会员状态</th>
		<td>${memberStatus.options[member.status].name}</td>
		<th>会员等级[暂不支援]</th>
		<td>${memberRank.options[member.rank].name}</td>
		<th>申请来源</th>
		<td>${channelMenu.options[member.applySource].name}(${member.applySource})</td>
	</tr>
	<tr>
		<th>站点</th>
		<td>${domainSrc.options[member.domainSrc].name}</td>
		<th>性别</th>
		<td>
			<c-rt:if test="${member.sex eq 'M'}">男</c-rt:if>
			<c-rt:if test="${member.sex eq 'F'}">女</c-rt:if>
		</td>
		<th>生日</th>
		<td><fmt-rt:formatDate value="${member.birthday}" pattern="yyyy-MM-dd"/></td>
	</tr>
	<tr>
		<c-rt:if test="${not empty member.unBlockDate}">	
		<th>解锁日期</th>
		<td><fmt-rt:formatDate value="${member.unBlockDate}"
							pattern="yyyy-MM-dd HH:mm" /></td>
		</c-rt:if>
		<c-rt:if test="${member.blackListId != 0 and empty member.unBlockDate}">		
			<th>快速解锁</th>
			<td><a href="#" id="unLock">快速解锁</a></td>
		</c-rt:if>	
	</tr>
	<tr>
		<th>手机</th>
		<td colspan="5">${pu:maskMobile(member.mobile)}<input type="button" value="清除手机验证日期" onclick="clearRegMobileInfo(1)"/><input type="button" value="清除手机验证次数" onclick="clearRegMobileInfo(2)"/><input type="button" value="清除手机验证日期+手机验证次数" onclick="clearRegMobileInfo(3)"/></td>
	</tr>
</table>
<p></p>
<ul class="tabs"> 
	<li><a href="#tabs-1" onclick="doAR('${midContextPath}/member/addressBook!search.do?AJAX=true&refreshZone=tabs-1&memberId=${member.memberId}','tabs-1')">地址簿</a></li>
	<li><a href="#tabs-2" onclick="doAR('${midContextPath}/member/wishList!search.do?AJAX=true&refreshZone=tabs-2&memberId=${member.memberId}','tabs-2')">追踪商品</a></li>
	<li><a href="#tabs-3" onclick="doAR('${midContextPath}/member/blackBook!search.do?AJAX=true&refreshZone=tabs-3&memberId=${member.memberId}','tabs-3')">异常记录历史</a></li>
	<li><a href="#tabs-4" onclick="doAR('${midContextPath}/member/searchOrders.do?AJAX=true&refreshZone=tabs-4&memberId=${member.memberId}&tabsId=tabs-4&pageFormname=online','tabs-4')">交易中订单</a></li>
	<li><a href="#tabs-5" onclick="doAR('${midContextPath}/member/searchOrders.do?AJAX=true&refreshZone=tabs-5&memberId=${member.memberId}&tabsId=tabs-5&pageFormname=offline','tabs-5')">历史订单</a></li>
	<li><a href="#tabs-6" onclick="doAR('${midContextPath}/member/searchCoupons.do?AJAX=true&refreshZone=tabs-6&memberId=${member.memberId}','tabs-6')">Coupon</a></li>
	<li><a href="#tabs-7" onclick="doAR('${midContextPath}/member/searchBonus.do?AJAX=true&refreshZone=tabs-7&memberId=${member.memberId}','tabs-7')">积分</a></li>
	<li><a href="#tabs-12" onclick="doAR('${midContextPath}/member/searchBonusTransfer.do?AJAX=true&refreshZone=tabs-12&memberId=${member.memberId}','tabs-12')">积分使用记录</a></li>
	<li><a href="#tabs-10" onclick="doAR('${midContextPath}/member/searchGiftcardList.do?AJAX=true&refreshZone=tabs-10&memberId=${member.memberId}','tabs-10')">礼品卡</a></li>
	<li><a href="#tabs-8" onclick="doAR('${midContextPath}/member/searchVirtualBalance.do?AJAX=true&refreshZone=tabs-8&memberId=${member.memberId}','tabs-8')">我的账户</a></li>
	<li><a href="#tabs-9" onclick="doAR('${midContextPath}/member/searchAffilatePartner.do?AJAX=true&refreshZone=tabs-9&memberId=${member.memberId}','tabs-9')">掘金联盟帐户资料</a></li>
	<li><a href="#tabs-11" onclick="doAR('${midContextPath}/member/searchLoginHistory.do?AJAX=true&refreshZone=tabs-11&memberId=${member.memberId}','tabs-11')">登录记录</a></li>
	<!--<li><a href="#tabs-10" onclick="doAR('${midContextPath}/member/searchAffilatePartner.do?AJAX=true&refreshZone=tabs-9&memberId=${member.memberId}','tabs-10')">问答</a></li>  -->
</ul>
<div class="panes">
	<div id="tabs-1"></div>
	<div id="tabs-2"></div>
	<div id="tabs-3"></div>
	<div id="tabs-4"></div>
	<div id="tabs-5"></div>
	<div id="tabs-6"></div>
	<div id="tabs-7"></div>
	<div id="tabs-12"></div>
	<div id="tabs-10"></div>
	<div id="tabs-8"></div>
	<div id="tabs-9"></div>
	<div id="tabs-11"></div>
	<!-- <div id="tabs-10"></div>  -->
</div>
<p></p>
<div class="f-link">
  <c-rt:if test="${not empty pop}"><a href="javascript:window.close()">关闭视窗</a> / </c-rt:if><c-rt:if test="${pu:substring(user.group.code, 0, 1)!='C'}"><a href="${midContextPath}/member/search.do">回会员查询页</a></c-rt:if><c-rt:if test="${pu:substring(user.group.code, 0, 1)=='C'}"><a href="../crmQuery/search.do">回CRM 查询</a></c-rt:if>
	<!-- <a href="${midContextPath}/member/edit.do?memberId=${member.memberId}">修改会员个人资料</a>
	<a id="updEmailLink" href="#">修改会员Email</a>
	<a id="ftPwd" href="#">会员忘记密码</a>
	 -->
</div>
<div id="updEmailDialog"></div>
